import { fileURLToPath, URL } from 'node:url'
import pxToViewport from 'postcss-px-to-viewport'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [VantResolver()],
    }),
  ],
  base:"/InternalTesting/",
  css: {
    postcss: {
      plugins: [
        pxToViewport({
          // 要转换的单位
          unitToConvert: 'px',
          // 设计稿的宽度
          viewportWidth: 375
        })
      ]
    }
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    port: 4000, // 服务端口号
    open: true, // 服务启动时是否自动打开浏览器
    cors: true ,// 允许跨域
    host:'0.0.0.0'
  },
})
